<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>resize Element</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
    <style>
        textarea {
            width: 300px;
            height: 200px;
            border: 4px solid;
            outline: none;
            text-align: center;
            font-size: 20px;
            font-weight: 700;
            }
    </style>
</head>
<body>
    <div id="app">
        <h3>"Please resize the box below!"</h3>
        <textarea 
          ref="targetElement"
          :style="{ lineHeight: `${height}px` }"
          readonly>{{ width }} x {{ height }}</textarea>
      </div>
      <script>  
        new Vue({
            el: '#app',
            data () {
                return {
                width: 0,
                height: 0
                }
        },
        mounted () {
            this.observeSize()
        },
        methods: {
            observeSize () {
            const ro = new ResizeObserver(entries => {
                entries.forEach(entry => {
                const { width, height } = entry.contentRect
                this.width = width
                this.height = height
                })
            })
            
            ro.observe(this.$refs.targetElement)
            }
        }
        })
      </script>
</body>
</html>